package com.neusoft.neuiotms.dcom.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.neusoft.bizcore.web.dto.result.PageResultDTO;
import com.neusoft.bizcore.web.dto.result.ResultListDTO;
import com.neusoft.bizcore.web.support.Searchable;
import com.neusoft.neuiotms.dcom.dto.InspectionRuleProjectItemDTO;
import com.neusoft.neuiotms.dcom.service.InspectionRuleProjectItemService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Api(tags = "巡检项管理")
@RestController
@RequestMapping(value = "/api/w/inspection/rule/item")
public class InspectionRuleProjectItemController {

    @Autowired
    private InspectionRuleProjectItemService itemService;

    @ApiOperation("查询所有巡检项")
    @GetMapping
    public ResultListDTO<InspectionRuleProjectItemDTO> index(final Searchable searchable) {
        return ResultListDTO.success(this.itemService.index(searchable));
    }

    @ApiOperation("分页查询巡检项")
    @GetMapping("/p")
    public PageResultDTO<InspectionRuleProjectItemDTO> page(final Searchable searchable, final Pageable pageable) {
        return PageResultDTO.success(this.itemService.page(searchable, pageable));
    }

    //    @ApiOperation("新增巡检项")
    //    @PostMapping
    //    public ResultDTO<InspectionRuleProjectItemDTO> create(@RequestBody final InspectionRuleProjectItemDTO dto) {
    //        return ResultDTO.success(this.itemService.create(dto));
    //    }
}
